interface Option {
  code: number;
  description: string;
}

/**
 * 下拉选项映射
 * @param arr
 * @returns
 */
export const convertOptions = (arr: any, type?: string) => {
  const data = arr.map((item: Option) => {
    if (type === 'kit') {
      // return item.description.replaceAll("'", '');
      const value = item.description.replaceAll("'", '');
      return { value, label: value };
    } else {
      return {
        value: item.code,
        label: item.description,
      };
    }
  });
  return data;
};
